#include <REGX52.H>
#include "Delay.h" 
#include "LCD1602.h"
#include "Timer0.h"
#include "IR.h"

unsigned char Num;
unsigned char Address;
unsigned char Command;


void main(void){ 
	LCD_Init();
	
	IR_Init();
	while(1) {  
		if(IR_GetDataFlag() || IR_GetRepeatFlag()) { //持续按键时，直接读上个数据
			Address = IR_GetAddress();
			Command = IR_GetCommand();
			
			LCD_ShowHexNum(2,1, Address,2);
			LCD_ShowHexNum(2,5, Command,2);
			
			if(Command == IR_VOL_ADD) { //按音量加时，数据加1
				Num++;
				LCD_ShowNum(1,1, Num, 4);
			}
		}
	}
} 